#ifndef _CCSPINELOADER_H_
#define _CCSPINELOADER_H_

#include "CCSkeleton.h"
#include "CCSpineObject.h"
#include "CCSkeletalAnimation.h"
#include "CCTransform.h"
#include "cJSON.h"
#include "cocos2d.h"

NS_CC_BEGIN

/**
 * loader of spine exported file
 */
class  CCSpineLoader {
    
private:
	/**
	 * load a spine skeleton model from json object
	 *
	 * @param jo \link wyJSONObject wyJSONObject\endlink
	 * @param scale scale rate for position value
	 * @return \link CCSkeleton CCSkeleton\endlink
	 */
    
	static CCSkeleton* loadSkeletonFromData(const char* data);
	
	/**
	 * load a spine skeletal animation from json object
	 *
	 * @param jo \link wyJSONObject wyJSONObject\endlink
	 * @param scale scale rate for position value
	 * @return \link CCSkeletalAnimation CCSkeletalAnimation\endlink
	 */
	static CCSkeletalAnimation* loadAnimation(cJSON* object, CCSkeleton* skeleton, map<const char*, SpineEvents, CCSpineGlobal::CCStrPredicate>& eventsMap);
    
    static ccColor4B getColorforStr(const char* str);
    
    static void loadCurve(cJSON* frame,CCTransform::Interpolator& interpolator);

public:
    
	/**
	 * load a spine skeleton model from file
	 *
	 * @param path path of file
	 * @param isFile false means \c path is a relative path to assets folder, or true means
	 * 		\c path is an absolute path in file system
	 * @return \link CCSkeleton CCSkeleton\endlink
	 */
	static CCSkeleton* loadSkeleton(const char* path);
};

NS_CC_END

#endif